import { Injectable } from "@angular/core";
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { DialogComponent } from "../cpt/dialog/dialog.component";
import { Subject } from "rxjs";

@Injectable({
  providedIn: "root"
})
export class DialogService {
  animal: string;
  name: string;

  constructor(public dialog: MatDialog) {}

  confirm(msg) {
    const dialogRef = this.dialog.open(DialogComponent, {
      data: {
        msg,
        type: "confirm"
      }
    });
    return dialogRef;
  }

  agree() {
    const dialogRef = this.dialog.open(DialogComponent, {
      data: {
        type: "agree"
      }
    });
    return dialogRef;
  }
}
